package com.azier.kapacitor.script.method;

import com.azier.kapacitor.script.arg.SingleQuotesArg;

import java.util.ArrayList;

/**
* 1 * @Author: luoj
* 2 * @Date: 2019/11/8 11:27
* 3
*/
public class Exec extends AbstractMethod {
    private static final String name = "exec";
    /**
    Execute a command whenever an alert is triggered and pass the alert data over STDIN in JSON format.
    **/
    /**
    每当触发警报时执行一条命令，并通过STDIN以JSON格式传递警报数据。
    **/
    public Exec(String executable, String... args) {
        super(new ArrayList<>(), name);
        //
        for(String argf : args){
            this.args.add(new SingleQuotesArg(argf));
        }


        //
        this.args.add(new SingleQuotesArg(executable));


    }
}
